$("#surelogin").click(function () {
    var username = $("#username").val();
    var password = $("#password").val();
    var type = $('input:radio[name="type"]:checked').val();

   $.ajax({
       url:"login",
       type:"post",
       data:{"username":username,"password":password,"type":type},
       dataType:"json",
       success:function (data) {
           switch (data.status) {
               case 1:
                   if(type == 0)    window.location.href="user";
                   else window.location.href="manager";
                   break;
               case 2:alert(data.mag); break;
               case 3:alert(data.mag); break;
           }
       }
   });
});
